<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>

  <!-- 引入react核心库 -->
  <script src="../js/react.development.js"></script>
  <!-- 引入react-dom,用于支持react操作DOM -->
  <script src="../js/react-dom.development.js"></script>
  <!-- 引入babel,用于将jsx转换为js -->
  <script src="../js/babel.min.js"></script>

  <body>
    <!-- 容器 -->
    <div id="app1"></div>
    <div id="app2"></div>
    <div id="app3"></div>
  </body>

  <script type="text/babel">
    class Person extends React.Component {
      render() {
        const { name, gender, age } = this.props;

        return (
          <ul>
            <li>姓名：{name}</li>
            <li>性别：{gender}</li>
            <li>年龄：{age}</li>
          </ul>
        );
      }
    }

    const personObj = {
      name: "周露",
      gender: "女",
      age: "18",
    };

    ReactDOM.render(<Person {...personObj} />, document.getElementById("app1"));
    ReactDOM.render(
      <Person name="李婉茹" gender="女" age="19" />,
      document.getElementById("app2")
    );
    ReactDOM.render(
      <Person name="茆雪" gender="女" age="20" />,
      document.getElementById("app3")
    );
  </script>
</html>
